package com.g2room.myuall.grap.univ.po;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;

import com.g2room.myuall.util.DbUtil;

public class ArtiCategoryPo {
	private String categoryCode;
	private String categoryName;
	private String typeCode;
	private String typeName;

	public static Map<String, ArtiCategoryPo> getCategories() {
		Map<String, ArtiCategoryPo> acps = new HashMap<String, ArtiCategoryPo>();
		try {
			Connection connection = DbUtil.getConn();
			Statement statement = connection.createStatement();
			String sql = "select * from ncee_category";
			ResultSet rs = statement.executeQuery(sql);
			while(rs.next()) {
				ArtiCategoryPo acp = new ArtiCategoryPo();
				acp.setCategoryCode(rs.getString("category_code"));
				acp.setCategoryName(rs.getString("category_name"));
				acp.setTypeCode(rs.getString("type_code"));
				acp.setTypeName(rs.getString("type_name"));
				acps.put(acp.getTypeName(), acp);
			}
			rs.close();
			statement.close();
		} catch(Exception e) {
			e.printStackTrace();
		}
		return acps;
	}
	
	public String getCategoryCode() {
		return categoryCode;
	}

	public void setCategoryCode(String categoryCode) {
		this.categoryCode = categoryCode;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public String getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

}
